package com.atguigu.userprofile.dao;

import com.atguigu.userprofile.bean.TagInfo;
import com.atguigu.userprofile.util.MySqlUtil;

/**
 * 负责TagInfo的增删改查
 */
public class TagInfoDao {

    public static void main(String[] args) {

        TagInfo tagInfo = selectTagInfoByTaskId("1");
        System.out.println(tagInfo);
    }

    /**
     * 通过任务id查询对应的TagInfo
     *
     */
    public static TagInfo selectTagInfoByTaskId( String taskId ){

        String querySql = "SELECT \n" +
                "id ,tag_code , tag_name , tag_level , parent_tag_id ,tag_type , tag_value_type , \n" +
                "tag_value_limit , tag_value_step , tag_task_id , tag_comment , update_time , create_time \n" +
                "FROM \n" +
                "tag_info \n" +
                "WHERE tag_task_id = " + taskId ;

        TagInfo tagInfo = MySqlUtil.selectOne(querySql, TagInfo.class, true);

        return tagInfo ;
    }
}
